#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

/**
 * Definition for a binary tree node.
 */
struct TreeNode {
	int val;
	struct TreeNode* left;
	struct TreeNode* right;
};

typedef struct TreeNode treeNode, *treeNode_p;
bool isSame(treeNode_p tree1, treeNode_p tree2);

int main()
{
	return 0;
}

bool isSubtree(struct TreeNode* root, struct TreeNode* subRoot)
{
	if (!root) return false;
	if (isSame(root, subRoot)) return true;
	return isSubtree(root->left, subRoot) || isSubtree(root->right, subRoot);
}

bool isSame(treeNode_p tree1, treeNode_p tree2)
{
	if (!tree1 && !tree2) return true;
	if (!tree1 || !tree2) return false;
	if (tree1->val != tree2->val) return false;

	return isSame(tree1->left, tree2->left) && isSame(tree1->right, tree2->right);
}
